package com.antis.olsl.magic.rank.detail;

import android.text.TextUtils;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.antis.olsl.arouterlib.MagicRoutePath;
import com.antis.olsl.base.BaseActivity;
import com.antis.olsl.magic.databinding.ActivityTop60ItemDetailBinding;
import com.antis.olsl.magic.response.GetTopAnalysisTotalResp;

@Route(path = MagicRoutePath.ACTIVITY_TOP60_ITEM_DETAIL)
public class Top60ItemDetailActivity extends BaseActivity<ActivityTop60ItemDetailBinding> {

    @Autowired
    String salesRoomIds;
    @Autowired
    String salesRoomName;
    @Autowired
    String startDate;
    @Autowired
    String endDate;
    @Autowired
    GetTopAnalysisTotalResp.ContentBean mBean;

    @Override
    protected ActivityTop60ItemDetailBinding getViewBinding() {
        return ActivityTop60ItemDetailBinding.inflate(getLayoutInflater(), baseBinding.getRoot(), true);
    }

    @Override
    protected void initViews() {
        ARouter.getInstance().inject(this);
    }

    @Override
    protected void initData() throws IllegalAccessException {
        if (!TextUtils.isEmpty(salesRoomName)) {
            viewBinding.textCommodityName.setText(salesRoomName);
        }
        StringBuilder stringBuilder = new StringBuilder();
        if (!TextUtils.isEmpty(startDate)) {
            stringBuilder.append(startDate);
            stringBuilder.append(" 至 ");
        }
        if (!TextUtils.isEmpty(endDate)) {
            stringBuilder.append(endDate);
        }
        if (!TextUtils.isEmpty(stringBuilder)) {
            viewBinding.textDate.setText(stringBuilder);
        }
        if (null != mBean) {
            // mTitleView.setText(mBean.itemName);
            if (!TextUtils.isEmpty(mBean.averageGrossMargin)) {
                viewBinding.textProfitMargin.setText(mBean.averageGrossMargin);
            }

            if (!TextUtils.isEmpty(mBean.stockQuantityProportion)) {
                viewBinding.textNumberProportion.setText(mBean.stockQuantityProportion);
            }

            if (!TextUtils.isEmpty(mBean.stockQuantity)) {
                viewBinding.textNumber.setText(mBean.stockQuantity);
            }

            if (!TextUtils.isEmpty(mBean.inventoryCostsProportion)) {
                viewBinding.textCostProportion.setText(mBean.inventoryCostsProportion);
            }

            if (!TextUtils.isEmpty(mBean.inventoryCosts)) {
                viewBinding.textCost.setText(mBean.inventoryCosts);
            }

            if (!TextUtils.isEmpty(mBean.inventoryPurchaseCostProportion)) {
                viewBinding.textPurchaseCostProportion.setText(mBean.inventoryPurchaseCostProportion);
            }

            if (!TextUtils.isEmpty(mBean.inventoryPurchaseCost)) {
                viewBinding.textPurchaseCost.setText(mBean.inventoryPurchaseCost);
            }

            if (!TextUtils.isEmpty(mBean.salesVolumeProportion)) {
                viewBinding.textSalesVolumeProportion.setText(mBean.salesVolumeProportion);
            }

            if (!TextUtils.isEmpty(mBean.salesVolume)) {
                viewBinding.textSalesVolume.setText(mBean.salesVolume);
            }

            if (!TextUtils.isEmpty(mBean.salesAmountProportion)) {
                viewBinding.textSalesAmountProportion.setText(mBean.salesAmountProportion);
            }

            if (!TextUtils.isEmpty(mBean.salesAmount)) {
                viewBinding.textSalesAmount.setText(mBean.salesAmount);
            }

            if (!TextUtils.isEmpty(mBean.salesProfitProportion)) {
                viewBinding.textSalesProfitProportion.setText(mBean.salesProfitProportion);
            }

            if (!TextUtils.isEmpty(mBean.salesProfit)) {
                viewBinding.textSalesProfit.setText(mBean.salesProfit);
            }
        }
    }
}
